<!--
SPDX-FileCopyrightText: 2020 George Florea Bănuș <georgefb899@gmail.com>

SPDX-License-Identifier: CC-BY-4.0
-->

<h2>Screenshot Template</h2>
<div><a href="https://mpv.io/manual/stable/#screenshot">https://mpv.io/manual/stable/#screenshot</a></div>
<div>
    <p class="first">Specify the filename template used to save screenshots. The template
        specifies the filename without file extension, and can contain format
        specifiers, which will be substituted when taking a screenshot.
        By default, the template is <tt class="docutils literal"><span class="pre">mpv-shot%n</span></tt>, which results in filenames like
        <tt class="docutils literal"><span class="pre">mpv-shot0012.png</span></tt> for example.
    </p>
    <p>The template can start with a relative or absolute path, in order to
        specify a directory location where screenshots should be saved.
    </p>
    <p>If the final screenshot filename points to an already existing file, the
        file will not be overwritten. The screenshot will either not be saved, or if
        the template contains <tt class="docutils literal">%n</tt>, saved using different, newly generated
        filename.
    </p>
    <p>Allowed format specifiers:</p>
    <dl class="last docutils">
        <dt><tt class="docutils literal" id="options-%[#][0x]n"><span class="pre">%[#][0X]n</span><a href="#options-%[#][0x]n" class="anchor fa fa-link"></a></tt></dt>
        <dd>A sequence number, padded with zeros to length X (default: 04). E.g.
            passing the format <tt class="docutils literal">%04n</tt> will yield <tt class="docutils literal">0012</tt> on the 12th screenshot.
            The number is incremented every time a screenshot is taken or if the
            file already exists. The length <tt class="docutils literal">X</tt> must be in the range 0-9. With
            the optional # sign, mpv will use the lowest available number. For
            example, if you take three screenshots--0001, 0002, 0003--and delete
            the first two, the next two screenshots will not be 0004 and 0005, but
            0001 and 0002 again.
        </dd>
        <dt><tt class="docutils literal" id="options-%f">%f<a href="#options-%f" class="anchor fa fa-link"></a></tt></dt>
        <dd>Filename of the currently played video.</dd>
        <dt><tt class="docutils literal" id="options-%f">%F<a href="#options-%f" class="anchor fa fa-link"></a></tt></dt>
        <dd>Same as <tt class="docutils literal">%f</tt>, but strip the file extension, including the dot.</dd>
        <dt><tt class="docutils literal" id="options-%x">%x<a href="#options-%x" class="anchor fa fa-link"></a></tt></dt>
        <dd>Directory path of the currently played video. If the video is not on
            the filesystem (but e.g. <tt class="docutils literal"><span class="pre">http://</span></tt>), this expand to an empty string.
        </dd>
        <dt><tt class="docutils literal" id="options-%x{fallback}">%X{fallback}<a href="#options-%x{fallback}" class="anchor fa fa-link"></a></tt></dt>
        <dd>Same as <tt class="docutils literal">%x</tt>, but if the video file is not on the filesystem, return
            the fallback string inside the <tt class="docutils literal"><span class="pre">{...}</span></tt>.
        </dd>
        <dt><tt class="docutils literal" id="options-%p">%p<a href="#options-%p" class="anchor fa fa-link"></a></tt></dt>
        <dd>Current playback time, in the same format as used in the OSD. The
            result is a string of the form "HH:MM:SS". For example, if the video is
            at the time position 5 minutes and 34 seconds, <tt class="docutils literal">%p</tt> will be replaced
            with "00:05:34".
        </dd>
        <dt><tt class="docutils literal" id="options-%p">%P<a href="#options-%p" class="anchor fa fa-link"></a></tt></dt>
        <dd>
            <p class="first">Similar to <tt class="docutils literal">%p</tt>, but extended with the playback time in milliseconds.
                It is formatted as "HH:MM:SS.mmm", with "mmm" being the millisecond
                part of the playback time.
            </p>
            <div class="admonition note last">
                <p class="first admonition-title">Note</p>
                <p class="last">This is a simple way for getting unique per-frame timestamps. (Frame
                    numbers would be more intuitive, but are not easily implementable
                    because container formats usually use time stamps for identifying
                    frames.)
                </p>
            </div>
        </dd>
        <dt><tt class="docutils literal" id="options-%wx">%wX<a href="#options-%wx" class="anchor fa fa-link"></a></tt></dt>
        <dd>
            <p class="first">Specify the current playback time using the format string <tt class="docutils literal">X</tt>.
                <tt class="docutils literal">%p</tt> is like <tt class="docutils literal"><span class="pre">%wH:%wM:%wS</span></tt>, and <tt class="docutils literal">%P</tt> is like <tt class="docutils literal"><span class="pre">%wH:%wM:%wS.%wT</span></tt>.
            </p>
            <dl class="last docutils">
                <dt>Valid format specifiers:</dt>
                <dd>
                    <dl class="first last docutils">
                        <dt><tt class="docutils literal" id="options-%wh">%wH<a href="#options-%wh" class="anchor fa fa-link"></a></tt></dt>
                        <dd>hour (padded with 0 to two digits)</dd>
                        <dt><tt class="docutils literal" id="options-%wh">%wh<a href="#options-%wh" class="anchor fa fa-link"></a></tt></dt>
                        <dd>hour (not padded)</dd>
                        <dt><tt class="docutils literal" id="options-%wm">%wM<a href="#options-%wm" class="anchor fa fa-link"></a></tt></dt>
                        <dd>minutes (00-59)</dd>
                        <dt><tt class="docutils literal" id="options-%wm">%wm<a href="#options-%wm" class="anchor fa fa-link"></a></tt></dt>
                        <dd>total minutes (includes hours, unlike <tt class="docutils literal">%wM</tt>)</dd>
                        <dt><tt class="docutils literal" id="options-%ws">%wS<a href="#options-%ws" class="anchor fa fa-link"></a></tt></dt>
                        <dd>seconds (00-59)</dd>
                        <dt><tt class="docutils literal" id="options-%ws">%ws<a href="#options-%ws" class="anchor fa fa-link"></a></tt></dt>
                        <dd>total seconds (includes hours and minutes)</dd>
                        <dt><tt class="docutils literal" id="options-%wf">%wf<a href="#options-%wf" class="anchor fa fa-link"></a></tt></dt>
                        <dd>like <tt class="docutils literal">%ws</tt>, but as float</dd>
                        <dt><tt class="docutils literal" id="options-%wt">%wT<a href="#options-%wt" class="anchor fa fa-link"></a></tt></dt>
                        <dd>milliseconds (000-999)</dd>
                    </dl>
                </dd>
            </dl>
        </dd>
        <dt><tt class="docutils literal" id="options-%tx">%tX<a href="#options-%tx" class="anchor fa fa-link"></a></tt></dt>
        <dd>Specify the current local date/time using the format <tt class="docutils literal">X</tt>. This format
            specifier uses the UNIX <tt class="docutils literal">strftime()</tt> function internally, and inserts
            the result of passing "%X" to <tt class="docutils literal">strftime</tt>. For example, <tt class="docutils literal">%tm</tt> will
            insert the number of the current month as number. You have to use
            multiple <tt class="docutils literal">%tX</tt> specifiers to build a full date/time string.
        </dd>
        <dt><tt class="docutils literal" id="options-%{prop[:fallback"><span class="pre">%{prop[:fallback</span> text]}<a href="#options-%{prop[:fallback" class="anchor fa fa-link"></a></tt></dt>
        <dd>Insert the value of the input property 'prop'. E.g. <tt class="docutils literal">%{filename}</tt> is
            the same as <tt class="docutils literal">%f</tt>. If the property does not exist or is not available,
            an error text is inserted, unless a fallback is specified.
        </dd>
        <dt><tt class="docutils literal" id="options-%%">%%<a href="#options-%%" class="anchor fa fa-link"></a></tt></dt>
        <dd>Replaced with the <tt class="docutils literal">%</tt> character itself.</dd>
    </dl>
</div>
